package com.csun.cmny.mqtt.core;

import com.csun.cmny.mqtt.utils.DateUtil;
import lombok.Data;

import java.util.Date;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-01-15 15:05
 * @Description:
 */
@Data
public class MqttClientConnectOptions {

    private String topic;

    /**
     * mqtt 连接服务器url
     */
    private String serverURI;
    /**
     * mqtt 用户名
     */
    private String userName;

    /**
     * mqtt 密码
     */
    private String passWord;

    /**
     * mqtt 客户端Id
     */
    private String clientId;

    /**
     * 是否是否session,false:保留记录;true:清除记录
     */
    private boolean cleanSession;

    /**
     * 心跳存活时间
     */
    private int keepAliveInterval;

    /**
     * 连接超时时间
     */
    private int connectionTimeout;

    public MqttClientConnectOptions() {
        this.clientId = "webClient_" + DateUtil.dateToStrs(new Date());
        this.cleanSession = true;
        this.keepAliveInterval = 30;
        this.connectionTimeout = 60;
    }

}
